home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_12_09 / saks / strq4.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-12  |  642 b   |  41 lines

  1. Listing 3 - class and inline member function definitions for a type-safe 
  2. queue of str wrapped around a genq
  3.  
  4. //
  5. // strq4.h - a type-safe wrapper for
  6. // a queue of str wrapped around a genq
  7. //
  8.  
  9. #include "genq4.h"
  10. #include "str.h"
  11.  
  12. class strq
  13.     {
  14. public:
  15.     ~strq();
  16.     void append(const str &e);
  17.     void apply(void f(void *e, void *a), void *args);
  18.     void clear();
  19.     int remove(str &e);
  20. private:
  21.     genq gq;
  22.     };
  23.  
  24. inline strq::~strq()
  25.     {
  26.     clear();
  27.     }
  28.  
  29. inline void strq::append(const str &e)
  30.     {
  31.     gq.append(new str (e));
  32.     }
  33.  
  34. inline void strq::
  35. apply(void f(void *e, void *a), void *args)
  36.     {
  37.     gq.apply(f, args);
  38.     }
  39.  
  40.  
  41.